/*
 * @# AlbumPhotoSize.java 2011-12-29 下午08:09:27
 * 
 * Copyright (C) 2010 - 2011 广州羿安信息科技有限公司
 * Guangzhou ianswer information technology co. ltd.
 * 
 * All rights reserved!
 */
package com.ianswer.px.album.io;

import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;

/**
 * @author alvin hwang
 */
public final class AlbumPhotoSize {

	private AlbumPhotoSize() {
		// empty!
	}

	public static class H80 {
		public static final String NAME = "-h80";
		public static final int HEIGHT = 80;

		public static String path(String url) {
			return AlbumPhotoSize.path(url, NAME);
		}
	}

	public static class H160 {
		public static final String NAME = "-h160";
		public static final int HEIGHT = 160;

		public static String path(String url) {
			return AlbumPhotoSize.path(url, NAME);
		}
	}

	public static class H220 {
		public static final String NAME = "-h220";
		public static final int HEIGHT = 220;

		public static String path(String url) {
			return AlbumPhotoSize.path(url, NAME);
		}
	}

	public static class H400 {
		public static final String NAME = "-h400";
		public static final int HEIGHT = 400;

		public static String path(String url) {
			return AlbumPhotoSize.path(url, NAME);
		}
	}

	public static class H600 {
		public static final String NAME = "-h600";
		public static final int HEIGHT = 600;

		public static String path(String url) {
			return AlbumPhotoSize.path(url, NAME);
		}
	}

	public static class W900 {
		public static final String NAME = "-w900";
		public static final int WIDTH = 900;

		public static String path(String url) {
			return AlbumPhotoSize.path(url, NAME);
		}
	}

	private static String path(String url, String name) {
		if (StringUtils.isEmpty(url)) {
			return StringUtils.EMPTY;
		}
		return FilenameUtils.getFullPath(url) + FilenameUtils.getBaseName(url) + name + "."
				+ FilenameUtils.getExtension(url);
	}
}
